KERNEL_PATH:=/home/bltzmnn/linux_kernel/linux_yz_4.1.15
CURRENT_PATH:=$(shell pwd)
#using nfs file system
ROOTFS_MODULE_PATH:=/home/bltzmnn/nfs_path/rootfs/lib/modules/4.1.15
ROOTFS_APP_PATH:=/home/bltzmnn/nfs_path/rootfs/tmp

NAME:= i2c_ap3216c 

BASE_NAME:=$(strip $(NAME))
obj-m:=$(BASE_NAME).o

APP_NAME :=$(BASE_NAME)_app
.PHONY: target clean app app_clean
target:
	$(MAKE) -C $(KERNEL_PATH) M=$(CURRENT_PATH) modules
	cp -f $(BASE_NAME).ko $(ROOTFS_MODULE_PATH)

clean:app_clean
	$(MAKE) -C $(KERNEL_PATH) M=$(CURRENT_PATH) clean
	rm -f $(ROOTFS_MODULE_PATH)/$(BASE_NAME).ko 

CC :=arm-linux-gnueabihf-gcc
app:
	$(CC) $(BASE_NAME)_app.c -o $(APP_NAME)
	cp -f $(APP_NAME) $(ROOTFS_MODULE_PATH)
app_clean:
	rm -f $(APP_NAME)
	rm -f $(ROOTFS_APP_PATH)/$(APP_NAME)
